package iteratorapplication;


// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
// #[regen=yes,id=DCE.E09457C6-9AAD-CB6B-9185-78C593276D54]
// </editor-fold> 
public class CompteCorrent2 {

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.5C717EE7-679B-C7E1-B80E-8225187E3FDC]
    // </editor-fold> 
    private String[] titulars;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.C121E94B-D120-9A4E-E75F-B2B13BADE845]
    // </editor-fold> 
    private int index;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.AA4A7383-1A0B-FE73-1B60-627C26FD5133]
    // </editor-fold> 
    public CompteCorrent2 () {
        titulars = new String[5];
        index=0;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.DE9111A4-BB7A-5300-5B63-05FA739FCD97]
    // </editor-fold> 
    public int getIndex () {
        return index;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.71AB3D21-758C-7A74-8C9B-0EE106FA1823]
    // </editor-fold> 
    public void setIndex (int val) {
        this.index = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.50637C39-672E-811D-34D1-3BE2992246AB]
    // </editor-fold> 
    public String[] getTitulars () {
        return titulars;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.5A8C9D4A-A7BB-AE5B-3CA7-E2E8F1C45277]
    // </editor-fold> 
    public void setTitulars (String[] val) {
        this.titulars = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.367E1C59-1EB0-FCB6-110E-4A75E8DA276C]
    // </editor-fold> 
    public void addTitular (String titular) {
         if (index < titulars.length){
        titulars[index]=titular;
        index++;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.0E6671C2-7222-3737-E226-BAC2EDC165FB]
    // </editor-fold> 
    }

    public IteratorIf iterator(){

             return new IteratorIf(){
             int it=0;

             public boolean hasNext() {
               return it < index;
            }

            public Object next() {
                return titulars[it++];
            }

        };
    }
}



